package controller;

import repository.RecordDAO;
import repository.UpdateDAO;

import java.sql.SQLException;

/**
 * @description:
 * @Author Felix Torn
 * @create: 2023-12-26 10:51
 **/
public class Record {
    public static boolean recordIncome(double amount, String source, String note) throws SQLException {
        return RecordDAO.recordIncome(amount, source, note) & UpdateDAO.updateBalance(amount);
    }
    public static boolean recordExpense(double amount, String category, String note) throws SQLException {
        return RecordDAO.recordExpense(amount, category, note) & UpdateDAO.updateBalance(-amount);
    }
    public static boolean recordExpense(double amount, String category, String note, int year, int month, int day, int hour, int minute, int second) throws SQLException {
        return RecordDAO.recordExpense(amount, category, note, year, month, day, hour, minute, second) & UpdateDAO.updateBalance(-amount);
    }

}
